package at.jsug.topicvoting.gwt1.client.remote.rest;

import com.google.gwt.core.client.GWT;
import com.kaboomerang.gwt.rest.client.handler.CollectionResponseHandler;
import com.kaboomerang.gwt.rest.client.resource.Resource;
import com.kaboomerang.gwt.rest.client.resource.ResourceCollection;
import com.kaboomerang.gwt.rest.client.resource.ResourceFactory;
import com.kaboomerang.gwt.rest.client.resource.impl.RailsJsonResourceCollection;

public class FetchTopicsRequest extends AbstractRestRequest {

	public void send(CollectionResponseHandler responseHandler) {
		System.out.println("FetchTopicsRequest.onRequestClicked()");
		
		ResourceCollection topic = new RailsJsonResourceCollection(
				this.constructUrl("/topics"), new ResourceFactory() {
					public Resource create() {
						return (Resource) GWT.create(TopicsResource.class);
					}
				});

		topic.findAll(responseHandler);

	}
}
